/*
 * seqFeederRandom.cpp
 *
 *  Created on: 2011-09-09
 *      Author: pawel
 */
#include"seqFeederRandom.h"
//#include<Bpp/Seq.all>
seqFeederRandom::seqFeederRandom(bpp::BasicSequence* seq, size_t seqs)
:seq(*seq),numOfSeqs(seqs),seqCounter(0)
{
}
bpp::BasicSequence* seqFeederRandom::getSeq(){
	if(empty)throw std::logic_error("List is Empty");
	bpp::BasicSequence *retPtr;
	seq.shuffle();
	retPtr = new bpp::BasicSequence(seq);
	seqCounter++;
	if(seqCounter >= numOfSeqs){
		empty = true;
		productionEnded = true;
		closed =true;

	}
	return retPtr;
}
void seqFeederRandom::pushSeq(bpp::BasicSequence* seq){}

void seqFeederRandom::pushAddParams(seqAlignParams *params, std::string seqName)
{
	optionalParams.insert(std::pair<std::string,seqAlignParams>(seqName,*params));

}


#include"Params/SeqAlignParams.h"
seqAlignParams *seqFeederRandom::getAddParam(std::string seqName)
{
	boost::unordered_map<std::string, seqAlignParams>::iterator iter;
	iter =optionalParams.find(seqName);
	if(iter == optionalParams.end()){
		return NULL;
	}
	seqAlignParams *retptr;
	retptr = new seqAlignParams(iter->second);
	return retptr;
}


